package com.yangj.dao;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.LinkedList;
import java.util.List;
import org.apache.commons.dbutils.ResultSetHandler;
import com.yangj.model.Game;
import com.yangj.model.ServiceType;
public class GameDao extends BaseDao  {
	public List<Game> getAll() {
		try {
			String sql="select id, name, icon from game";
			return queryRunner.query(sql, new ResultSetHandler<List<Game>>() {
				@Override
				public List<Game> handle(ResultSet rs) throws SQLException {
					List<Game> list=new LinkedList<>();
					while(rs.next()) {
						list.add(new Game(rs.getInt("id"),
								rs.getString("name"),
//								path + rs.getString("icon")));
								rs.getString("icon")));
					}
					System.out.println(list.size());
					return list;
				}
			});
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return null;
	}
}
